/*
 * Copyright 2009 Kindleit Technologies. All rights reserved. This file, all
 * proprietary knowledge and algorithms it details are the sole property of
 * Kindleit Technologies unless otherwise specified. The software this file
 * belong with is the confidential and proprietary information of Kindleit
 * Technologies. ("Confidential Information"). You shall not disclose such
 * Confidential Information and shall use it only in accordance with the terms
 * of the license agreement you entered into with Kindleit.
 */


package net.kindleit.mpd.jukebox;

import java.util.List;

import org.apache.wicket.model.IModel;
import org.bff.javampd.MPD;
import org.bff.javampd.exception.MPDConnectionException;
import org.bff.javampd.exception.MPDResponseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

final class MPDStatusModel implements IModel<List<String>> {

  private static final Logger LOG = LoggerFactory.getLogger(MPDStatusModel.class);

  private final MPD mpd;

  MPDStatusModel(final MPD mpd) {
    this.mpd = mpd;
  }

  public List<String> getObject() {
    try {
      return (List<String>) mpd.getStatus();
    } catch (final MPDConnectionException e) {
      LOG.error("connection error: " +  e.getMessage());
    } catch (final MPDResponseException e) {
      LOG.error("response exception: " +  e.getMessage());
    }
    return null;
  }

  public void setObject(final List<String> arg0) {
  }

  public void detach() {
  }
}
